PostgreSql
Connect to PostgreSql
psql -h <hostname> -p <port> -U <username> -d <database>
psql -h myhost -p 5432 -U myapplicationuser -d applicationdb- With host
postgresql://<username>:<password>@<hostname>:<port>/<database>
psql postgresql://myapplicationuser:mypass@myhost:1234/applicationdbBasic usage
List all database
\lConnect to specific database
\c <db_name>
\c usersList all tables in database
\dList all details with the tables
\d+ <table_name>Delete stuff
Delete database
DROP DATABASE <database_name>;Delete tables
DROP TABLE <table_name>;Create user
CREATE USER <user_name> WITH PASSWORD '<user_password>' SUPERUSER;
ALTER ROLE <user_name> WITH LOGIN;Exit
quit  Last updated on